﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WmsApp.Window;

namespace WmsApp.WindowControl
{
    public interface IConfirmWrap
    {
        DateTime? ConfirmDate { get; }
        bool IsConfirmOk { get; }
    }

    public class ConfirmWrap:IConfirmWrap
    {
        private FormConfirmInOut form = null;
        public ConfirmWrap(ConfirmInOutType confirmInOutType)
        {
            form = new FormConfirmInOut(confirmInOutType);
            
            form.ShowDialog();
            if(form.DialogResult == DialogResult.OK)
            {
                ConfirmDate = form.InOutDate;
                IsConfirmOk = true;
            }
            else
            {
                ConfirmDate = null;
                IsConfirmOk = false;
            }
        }

        public ConfirmWrap(DateTime? dateTime, ConfirmInOutType confirmInOutType)
        {
            form = new FormConfirmInOut(dateTime, confirmInOutType);

            form.ShowDialog();
            if (form.DialogResult == DialogResult.OK)
            {
                ConfirmDate = form.InOutDate;
                IsConfirmOk = true;
            }
            else
            {
                ConfirmDate = null;
                IsConfirmOk = false;
            }
        }

        public DateTime? ConfirmDate { get; private set; }

        public bool IsConfirmOk { get; private set; }
    }
}
